﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;

namespace FYPDemo
{
    public partial class Shopping : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Session["page"] = "shopping";
                bindDDLCategory();
                bindVendorLogo();
            }
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string category = ddlCategory.SelectedItem.ToString();

            Response.Redirect("displayProduct.aspx?category=" +category);
        }

        protected void bindDDLCategory()
        {
            DataTable dt = ProductManagement.bindProductCategory();

            ddlCategory.DataSource = dt;
            ddlCategory.DataTextField = "Value";
            ddlCategory.DataValueField = "CategoryID";
            ddlCategory.DataBind();
        }

        protected void bindVendorLogo()
        {
            DataTable dt = ProductManagement.listVendorLogo();

            VendorList_LV.DataSource = dt;
            VendorList_LV.DataBind();
        }
    }
}